CREATE TABLE [dbo].[RECIBOS_PAGOS]
(
[ID] [numeric] (10, 0) NOT NULL IDENTITY(1, 1),
[NRO_DOCUMENTO] [numeric] (10, 0) NOT NULL,
[ID_CLIENTE] [numeric] (10, 0) NOT NULL,
[ID_USUARIO] [numeric] (10, 0) NOT NULL,
[ID_VENDEDOR] [numeric] (10, 0) NOT NULL,
[ES_CONSIGNACION] [bit] NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_ES_CONSIGNACION] DEFAULT ((0)),
[FECHA] [datetime] NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_FECHA] DEFAULT (getdate()),
[REFERENCIA] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[M_TOTAL] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_M_TOTAL] DEFAULT ((0)),
[M_DESCUENTO] [numeric] (10, 2) NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_M_DESCUENTO] DEFAULT ((0)),
[OBSERVACIONES] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ACTIVO] [bit] NOT NULL CONSTRAINT [DF_RECIBOS_PAGOS_ACTIVO] DEFAULT ((1))
) ON [PRIMARY]
ALTER TABLE [dbo].[RECIBOS_PAGOS] ADD
CONSTRAINT [FK_RECIBOS_PAGOS_VENDEDORES] FOREIGN KEY ([ID_VENDEDOR]) REFERENCES [dbo].[VENDEDORES] ([ID])
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS] ADD CONSTRAINT [PK_RECIBOS_PAGOS] PRIMARY KEY CLUSTERED  ([ID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS] ADD CONSTRAINT [FK_RECIBOS_PAGOS_RECIBOS_PAGOS] FOREIGN KEY ([ID]) REFERENCES [dbo].[RECIBOS_PAGOS] ([ID])
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS] ADD CONSTRAINT [FK_RECIBOS_PAGOS_CLIENTES] FOREIGN KEY ([ID_CLIENTE]) REFERENCES [dbo].[CLIENTES] ([ID])
GO
ALTER TABLE [dbo].[RECIBOS_PAGOS] ADD CONSTRAINT [FK_RECIBOS_PAGOS_USUARIOS] FOREIGN KEY ([ID_USUARIO]) REFERENCES [dbo].[USUARIOS] ([ID])
GO
